CC=g++
CFLAGS=-I.
LDFLAGS=-L. -lFTD2xx

SOURCES=main.cpp global.cpp packets\crc.cpp allocations\daq.cpp allocations\comPort.cpp allocations\packetHandlers.cpp allocations\packetUtils.cpp
SOURCESLIB=ootbLib.cpp global.cpp packets\crc.cpp allocations\daq.cpp allocations\comPort.cpp allocations\packetHandlers.cpp allocations\packetUtils.cpp

#OBJECTS=$(SOURCES:.cpp=.o)
#OBJECTSLIB=$(SOURCESLIB:.cpp=.o)

EXECUTABLE=test.exe
LIBRARY=ootbLib.dll

all: $(SOURCES)
	$(CC) -O2 -m32 $(SOURCES) $(CFLAGS) -o $(EXECUTABLE) -Wl,--enable-stdcall-fixup -LC:\Windows\System32 -lftd2xx      

lib: $(SOURCESLIB) $(LIBRARY)
	$(CC) -O2 -m32 -shared $(SOURCESLIB) $(CFLAGS) -o $(LIBRARY) -Wl,--enable-stdcall-fixup -LC:\Windows\System32 -lftd2xx
	
#$(EXECUTABLE): $(OBJECTS)
#	$(CC) $(OBJECTS) -o $@ $(LDFLAGS)

#$(LIBRARY): $(OBJECTSLIB)
#	$(CC) $(OBJECTS) -shared -fPIC -o $@ $(LDFLAGS)

#.cpp.o:
#	$(CC) $(CFLAGS) -shared -fPIC $< -o $@
	
clean:
	rm packets/*.o; rm allocations/*.o;